import $ from "jquery"

let dark = false // flag of the theme mode
	
let theme = $("#theme")
let themeBtn = $("#theme-btn")
let themeIcon = $("#theme-btn > img")
themeBtn.click(() => {
	dark = !dark
	if(dark) {
		theme.attr({href: "/src/theme/dark.less"})
		themeIcon.attr({src: "/src/assets/light.svg"})
		themeBtn.attr({title: "light theme"})
	} else {
		theme.attr({href: "/src/theme/light.less"})
		themeIcon.attr({src: "/src/assets/dark.svg"})
		themeBtn.attr({title: "dark theme"})
	}
})

// wasm used here
import init, { greet } from "../wasm/pkg/your_wasm_app_name"
init().then(() => {
	$("#pad").click(() => {
		greet("it works")
	})
})
